package com.adou.p2p.respository;

import java.util.Optional;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.adou.p2p.domain.entiry.User;

public interface UserRespository extends CrudRepository<User, Long>, JpaSpecificationExecutor<User>{
	
	@Query("select t from User t where t.id = :id")
	Optional<User> findById(int id);
	
	/**
	 * 根据用户名和密码查询用户
	 * @param username
	 * @param password
	 * @return
	 */
	User findByUsernameAndPassword(String username, String password);
	
}
